.modalBox{:id => "add_sla_instance_modalBox"}
  = form_tag  "#", :id => "new-sla_instance-form",:method =>:put, :remote => true do
    .modalBox-title=t('apps.add_sls')
    .modalBox-flash
    .modalBox-content
      %table
        %tbody
          %tr
            %td
              = sprite_tag("help", :alt => "?", :class=> "help", :title => t('apps.name_help_html'))
              = label_tag "name", t('apps.name') + ":"
            %td
              = text_field_tag :names,@names, :size => 30, :required => "required", :autofocus => "autofocus",
                :placeholder => t('apps.name_placeholder'), :pattern => "[a-zA-Z0-9-_]+", :title => t('apps.name_title_html')
              .form-field-error
            %td
              = sprite_tag("help", :alt => "?", :class=> "help", :title => t('apps.disk_size_help_html'))
              = label_tag "disksize", t('apps.disk_size') + ":"
            %td
              = select_tag :disksize, options_for_select(@available_disksizes), :required => "required",
                :class => "disk-chosen", :style => "width: 100px;"
              .form-field-error
          %tr
            %td
              = sprite_tag("help", :alt => "?", :class=> "help", :title => t('apps.memory_size_help_html'))
              = label_tag "memsize", t('apps.memory_size') + ":"
            %td
              = select_tag :memsize, options_for_select(@available_memsizes), :required => "required",
                :class => "memory-chosen", :style => "width: 100px;"
              .form-field-error
            %td
              = sprite_tag("help", :alt => "?", :class=> "help", :title => t('apps.instances_num_help_html'))
              = label_tag "instances", t('apps.instances_num') + ":"
            %td
              = number_field_tag :instances, @instances, :min => 1, :max => @available_instances, :required => "required"
              .form-field-error
          %tr
            %td
              = sprite_tag("help", :alt => "?", :class=> "help", :title => t('apps.app_starttime_help_html'))
              = label_tag "app_starttime", t('apps.app_starttime') + ":"
            %td
              = text_field_tag :app_starttime, @app_starttime, :size => 30, :required => "required",  :placeholder => t('apps.time_placeholder'),
                 :id => "app_starttime"
              .form-field-error
            %td
              = sprite_tag("help", :alt => "?", :class=> "help", :title => t('apps.type_help_html'))
              = label_tag "type", t('apps.type') + ":"
            %td
              = select_tag :type, options_for_select(@available_frameworks), :required => "required",:class => "type-chosen", :style => "width: 300px;"
              .form-field-error
          %tr
            %td
              = sprite_tag("help", :alt => "?", :class=> "help", :title => t('apps.app_stoptime_help_html'))
              = label_tag "app_stoptime", t('apps.app_stoptime') + ":"
            %td
              = text_field_tag :app_stoptime, @app_stoptime, :size => 30, :required => "required",  :placeholder => t('apps.time_placeholder')
              .form-field-error
            %td
              = sprite_tag("help", :alt => "?", :class=> "help", :title => t('apps.bind_service_help_html'))
              = label_tag "service", t('apps.bind_service') + ":"
            %td
              = select_tag :service, options_for_select(@available_services), :class => "service-chosen", :style => "width: 300px;"
              .form-field-error

    .modalBox-title=t('apps.optional_business')
    .modalBox-content
      %table
        %tbody
          %tr
            %td
              = sprite_tag("help", :alt => "?", :class=> "help", :title => t('apps.mode_help_html'))
              = label_tag "instancemode", t('apps.paymode_instance')
            %td
              = check_box_tag :instancemode,true,@instancemode
              .form-field-error
          %tr
            %td
              = sprite_tag("help", :alt => "?", :class=> "help", :title => t('apps.mode_help_html'))
              = label_tag "monthmode", t('apps.paymode_month')
            %td
              = check_box_tag :monthmode,true,@monthmode
              .form-field-error
          %tr
            %td
              = sprite_tag("help", :alt => "?", :class=> "help", :title => t('apps.price_help_html'))
              = label_tag "price", t('apps.price') + "--for each instance/month"
            %td
              = text_field_tag :price, @price, :size => 30, :required => "required"
              .form-field-error
          %tr
            %td
              = sprite_tag("help", :alt => "?", :class=> "help", :title => t('apps.fine_help_html'))
              = label_tag "fine", t('apps.fine') + "--for each month for service interruptions"
            %td
              = text_field_tag :fine, @fine, :size => 30, :required => "required"
              .form-field-error
    .modalBox-submit= submit_tag t('sla_instances.add_sla')


  - content_for :javascripts do
    :javascript
      $(function() {
        $(document)
          .on('focus', '#new-sla_instance-form input#app_starttime', function() {
            if ($(this).val() == "") {
              //var app_name = $('#new-sla_instance-form input#names');
                       $('#new-sla_instance-form input#app_starttime').datetimepicker({
                                                           	timeFormat: 'HH:mm:ss',
                                                            	stepHour: 2,
                                                            	stepMinute: 10,
                                                            	stepSecond: 10
                                                          });
              //$(this).val('http://' + app_name.val());
            }
          });
      });
